package Book;

public class Book {
    private String name;//书名
    private String author; //作者
    private double price;//价格
    private String type;//类型
    private boolean situation;//是否被借出， false为 为借出，true表示借出

    public Book(String name, String author, double price, String type) {
        this.name = name;
        this.price = price;                        //初始化 成员，  situation 是 成员变量 默认是 false 未借出。
        this.author = author;
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean isSituation() {
        return situation;
    }

    public void setSituation(boolean situation) {
        this.situation = situation;
    }

    @Override
    public String toString() {
        return ("{ 书名：《" + name
                +"》 作者：" + author
                +"  价格：" + price
                +"  状态：" + (situation ? "该书已借出" : "该书未借出")
                + " }");
    }

}
